package com.xxx.datalake.service;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * @ Author: Aneve
 * @ Project: datalake
 * @ Since: 2022/9/20 18:57
 * @ Description:
 */
public class JdbcConnection {

    /*public Connection getPgSqlConnection(String pgUri, String pgDBName, String pgDBPassword){
        Connection conn = null;
        try {
            Class.forName("org.postgresql.Driver");
            conn = DriverManager.getConnection("jdbc:postgresql://" + pgUri + ":5432/" + pgDBName,pgDBName,pgDBPassword);
        } catch (ClassNotFoundException | SQLException e) {
            e.printStackTrace();
        }
        return conn;
    }*/

    public Connection getMySqlConnection(String mySqlUrl,String username,String password){
        Connection conn = null;
        try {
            Class.forName("com.mysql.jdbc.Driver");
            conn = DriverManager.getConnection(mySqlUrl,username,password);
        } catch (ClassNotFoundException | SQLException e) {
            e.printStackTrace();
        }
        return conn;
    }
}
